package com.ewayde.base.domain;

import me.desair.tus.server.TusFileUploadService;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * @author yanwei li create  2024-07-29 19:09
 */
@Configuration
public class TusConfig {

    @Value("${tus.upload.path}")
    private String uploadURIPath;

    @Value("${spring.profiles.active}")
    private String springActiveProperties;

    @Bean
    public TusFileUploadService tusFileUploadService() {
        return new TusFileUploadService()
//                文件上传由流览器客户端发起
//                .withStoragePath("")
                .withDownloadFeature()
                .withUploadUri(uploadURIPath + "/"+springActiveProperties)
                .withThreadLocalCache(true);
    }
}
